﻿#region Copyright Jonathan Quiros

//	
// All rights are reserved. Reproduction or transmission in whole or in 
// part, in any form or by any means, electronic, mechanical or otherwise, 
// is prohibited without the prior written consent of the copyright owner.
//
// Filename: HomeController.cs
//

#endregion

using System.Web.Mvc;
using Novagoal.Logic;
using Novagoal.Website.Models.Views;

namespace Novagoal.Website.WebApp.Controllers
{
    public class HomeController : BaseController
    {
        private readonly GamesLogic _gamesLogic;
        private readonly PartiesLogic _partiesLogic;

        #region Public Methods

        public HomeController(UsersLogic usersLogic, GamesLogic gamesLogic, PartiesLogic partiesLogic) : base(usersLogic)
        {
            _gamesLogic = gamesLogic;
            _partiesLogic = partiesLogic;
        }

        [HttpGet]
        public ActionResult Index()
        {
            var currentUser = GetUserInformation();
            var viewModel = new HomeViewModel
                                {
                                    UpcomingGames = _gamesLogic.UpcommingGames(currentUser.Person.Id),
                                    FinishedGames = _gamesLogic.FinishedGames(currentUser.Person.Id),
                                    GamesInProgress = _gamesLogic.GamesInProgress(currentUser.Person.Id),
                                    Rankings = _partiesLogic.GetRankings(currentUser.Person.Id),
                                    GlobalRankings = _partiesLogic.GetGlobalRankings(currentUser.Person.Id),
                                };

            return View("Index"+currentUser.Person.Language, viewModel);
        }

        #endregion

        #region Private Methods


        #endregion
    }
}
